// types/reconciliation.ts
export interface ReconciliationResult {
  id: string
  orderInfo: {
    platformOrderId: string
    customerName: string
    orderAmount: number
    orderDate: string
    invoiceStatus: string
  }
  transactionInfo: {
    transactionId: string
    payerName: string
    transactionAmount: number
    transactionDate: string
    bankName: string
  }
  matchInfo: {
    matchType: 'auto' | 'manual'
    matchAlgorithm: string
    confidence: number
    matchStatus: 'confirmed' | 'pending' | 'rejected'
    matchedBy?: string
    matchedAt: string
    confirmedBy?: string
    confirmedAt?: string
  }
  differenceInfo?: {
    amountDiff: number
    dateDiff: number
    nameSimilarity: number
    hasDifferences: boolean
    differenceType: 'amount' | 'date' | 'name' | 'multiple'
  }
  reasoning: {
    factors: Array<{
      factor: string
      score: number
      weight: number
      description: string
    }>
    totalScore: number
  }
}

export interface ReconciliationQueryParams {
  page: number
  limit: number
  matchStatus?: string
  confidenceRange: [number, number]
  customerName?: string
  reconciliationDateRange?: string[]
  maxAmountDiff?: number
  algorithm?: string
  operator?: string
  dataSource?: string
  includeDifferences?: boolean
}

export interface ReconciliationStats {
  matchedCount: number
  pendingCount: number
  unmatchedCount: number
  accuracyRate: number
  autoMatchedCount: number
  avgConfidence: number
  efficiencyScore: number
  accuracyTrend: number
  autoMatchTrend: number
  confidenceTrend: number
  efficiencyTrend: number
}